<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        "use strict"
        function foo(){
            console.log(this.a)
        }
        var a = 2;
        foo.call(null)
        foo.apply(null)
        var fooSub = foo.bind(null)
        fooSub();
        //  输出都是2
        console.log("------------这是分割线----------")
        var person = {
            a:4,
            foo
        }

        person.foo()    // 4
        person.foo.call(null);      // 2
        person.foo.apply(null);     // 2
        person.foo.bind(null)();    // 2
        // 当显式绑定传入null之后，会直接使用默认绑定
    </script>
</body>
</html>